import { UserResDto } from '@/modules/app/user/dto/user.dto';
import { IntersectionType, PartialType, PickType } from '@nestjs/swagger';
import { User } from '../entities/user.entity';
import { PaginationReqDto } from '@/types/globalDto.dto';
import { IsString } from 'class-validator';

export class AdminUserPageReqDto extends PartialType(
  IntersectionType(PickType(User, ['userId', 'phone']), PaginationReqDto),
) {}
export class AdminUserResDto {
  /**
   * 总数
   */
  total: number;

  /**
   * 列表
   */
  list: UserResDto[];
}

export class AdminLoginUserDto extends PickType(User, ['phone', 'password']) {
  /**
   * 验证码
   */
  @IsString()
  code: string;
}

export class CaptchaResultDto {
  /**
   * 验证码ID
   */
  id: string;
  /**
   * base64 图片
   */
  imageBase64: string;
  /**
   * 验证码
   */
  text: string;
}
